<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>纯前端管理系统</title>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <link rel="stylesheet" href="./statics/css/iview.css">
  <link rel="stylesheet" href="./statics/css/home.css">
  <script src="./statics/libs/iview1.js"></script>
  <script src="./statics/libs/vue.min.js"></script>
  <script src="./statics/libs/jquery.min.js"></script>
  <script src="./js/Constants.js"></script>
  <script src="./js/Api.js"></script>
</head>
<body>
<div id="app" v-cloak class="login">
	<div style="text-align:center;">
		<img class="logo-l" src="./statics/images/logo-l.png">
	</div>
	<div class="clear"></div>
	<div class="login-form border-ra">
		<!-- <h1 class="form-logo"></h1> -->
		<h2 style="color:#036dd1;text-align: center; margin:15px 0 40px 0;">纯前端管理系统</h2>
		<div class="form-item-login-error" ></div>
		<div class="form-item">
			<i class="item-icon user-icon"></i>
			<input v-model="username" type="text" class="input input-large border-ra" placeholder="用户名">
		</div>
		<div class="form-item">
			<i class="item-icon password-icon"></i>
			<input v-model="password" type="password" class="input input-large border-ra"
				placeholder="密码">
		</div>
		<div class="form-item">
			<button class="border-ra form-btn box-shadow-style" @click="login">登录</button>
		</div>
		
	</div>
	<div class="copyright">技术支持 &nbsp;剑波科技股份有限公司</div>
</div>
</body>
</html>

<script src="./statics/libs/jquery.min.js"></script>
<script type="text/javascript">
var vm = new Vue({
	el:'#app',
	data:{
		username: 'admin',
		password: '123456',
		captcha: '',
		error: false,
		errorMsg: '' 
	},
	created: function(){
		if(self != top){
			top.location.href = self.location.href;
		}
	},
	methods: {
		login: function (event) {
			console.log('login');
			var param = {
				cname: vm.username,
				cpwd: vm.password
			};
			console.log('login', param);
			Api.post("user/login", param, function(result) {
				if (result.status == 'success') {
					window.location.href = './home.html';
				} else {
					$(".form-item-login-error").html("提示：" + result.msg);
					vm.error = true;
					vm.errorMsg = result.msg;
				}	
			}, "json");
		}
	}
});
</script>


